package com.grasp.base;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler.Callback;
import android.os.Message;

import cc.wulian.ihome.wan.NetSDK;

import com.grasp.netsdk.NetSDKCallBack;

public class BaseActivity extends Activity implements Callback {

	protected Handler mHandler = new Handler(this);
	protected NetSDKCallBack mNetSDKCallBack = new NetSDKCallBack(mHandler);
	private GraspApplication mGraspApplication;

	@Override
	protected void onCreate(Bundle mBundle) {
		super.onCreate(mBundle);
		Logger.d(getClass().getName() + "===>onCreate");
		NetSDK.init(mNetSDKCallBack);
		mGraspApplication = (GraspApplication) getApplication();
	}

	@Override
	protected void onStart() {
		super.onStart();
		Logger.d(getClass().getName() + "===>onStart");
	}

	@Override
	protected void onResume() {
		super.onResume();
		Logger.d(getClass().getName() + "===>onResume");
	}

	@Override
	protected void onRestart() {
		super.onRestart();
		Logger.d(getClass().getName() + "===>onRestart");
	}

	@Override
	protected void onPause() {
		super.onPause();
		Logger.d(getClass().getName() + "===>onPause");
	}

	@Override
	protected void onStop() {
		super.onStop();
		Logger.d(getClass().getName() + "===>onStop");
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		Logger.d(getClass().getName() + "===>onDestroy");
	}

	@Override
	public boolean handleMessage(Message msg) {
		Logger.d(getClass().getName() + "===>handleMessage_what:"+msg.what);
		return false;
	}

	public void setAppID(String appID) {
		mGraspApplication.setAppID(appID);
	}

	public String getAppID() {
		return mGraspApplication.getAppID();
	}

	public void setGatewayID(String gatewayID) {
		mGraspApplication.setGatewayID(gatewayID);
	}

	public String getGatewayID() {
		return mGraspApplication.getGatewayID();
	}

}
